/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package engine;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author Joshua Chang
 */
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        // Get number of players
        System.out.println("How many players? ");
        int inPlayers = 0;
        try {
            inPlayers = Integer.parseInt(br.readLine());
        } catch (IOException e) {
            System.out.println("Error reading # of players: " + e.getMessage());
        }

        // Get difficulty desired
        System.out.println("What level difficulty? ");
        int inDifficulty = 0;
        try { 
            inDifficulty = Integer.parseInt(br.readLine());
        } catch (IOException e) {
            System.out.println("Error reading difficulty lvl: " + e.getMessage());
        }

        // Start game
        Game game = new Game(inPlayers, inDifficulty);
        game.initializeGame();

        int playerCounter = 0;
        while (!game.getGameOver()) {
            Player currentPlayer = game.getPlayers().get(playerCounter);
            System.out.println("It is the " + currentPlayer.getRole() + "'s turn.  What would you like to do?");
            String commands = "Commands: 'Drive', 'Direct Ferry', 'Charter Flight', 'Shuttle Flight', 'Pass'";
            if (currentPlayer.getRole().equalsIgnoreCase("dispatcher"))
                commands += ", 'Dispatch'";
            commands += ", 'Build', 'Cure', 'Treat', 'Share'";
            System.out.println(commands);
            String pCommand = "";
            pCommand = br.readLine();

            System.out.println(currentPlayer.getRole() + " " + pCommand);

            playerCounter = playerCounter + 1 % 4;
        }
    }
}
